package com.neusoft.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.tju.po.User;


@Mapper
public interface UserMapper {
	
	 @Select("select * from user where userId=#{userId} and password=#{password}")
	 public User getUserByIdByPass(User user);
	 @Select("select count(*) from user where userId=#{userId}")
	 public int getUserById(String userId);
	 @Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},null,1)")
	 public int saveUser(User user);

	@Select("select * from user where userId=#{userId} and delTag=1")
	public User getDetailedUserById(User user);

	@Update("update user set password=#{password},userName=#{userName},userSex=#{userSex} where userId=#{userId} and delTag=1")
	public int updateUser(User user);

	//会员过期
	@Update("update user set member=0 where userId=#{userId} and delTag=1")
	public int quitMember(User user);


	@Update("update user set member=1,startDate=#{startDate},period=#{period} where userId=#{userId} and delTag=1")
	public int addMember(User user);


}
